# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=mikrotik-npk
pkgver=11.d54e97c
pkgrel=4
groups=('blackarch' 'blackarch-reversing' 'blackarch-binary'
        'blackarch-networking' 'blackarch-packer' 'blackarch-unpacker')
pkgdesc='Python tools for manipulating Mikrotik NPK format.'
arch=('any')
url='https://github.com/kost/mikrotik-npk'
license=('custom:unknown')
depends=('python2')
makedepends=('git')
source=("git+https://github.com/kost/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|/usr/bin/env python|/usr/bin/env python2|' *.py
}

package() {
  cd $pkgname

  for i in *.py ; do
    install -Dm 755 $i "$pkgdir/usr/bin/`echo $i | cut -d '.' -f 1`"
  done

  install -Dm 644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
  #install -Dm644 LICENSE "$pkgdir/usr/share/licenses/mikrotik-npk/LICENSE"
}

